<template>
  <div class="divBox">
  
    <el-card class="box-card">
      <div class="clearfix">
        <!-- <el-tabs v-if="headTab.length > 0" v-model="currentTab" style="pointer-events: none;"> -->
        <el-tabs v-if="headTab.length > 0" v-model="currentTab" >  
          <el-tab-pane
            v-for="(item, index) in headTab"
            :key="index"
            :name="item.name"
            :label="item.title"
            :before-leave="leave"
          />
        </el-tabs>
      </div>
       <!-- 产品消息 -->
      <el-form
        ref="baseInfoForm"
        :key="currentTab"
        v-loading="fullscreenLoading"
        class=" mt20"
        :rules="ruleValidate"
        :model="baseInfoForm"
        label-width="130px"
        @submit.native.prevent
        v-if="currentTab == '1'"
      >
         <!-- 产品信息--> 
        <el-row :gutter="24">
          <!-- 产品消息--> 
          <el-col :span="24">
            <el-form-item label="主标题：" prop="store_name">
              <el-input
                v-model="baseInfoForm.store_name"
                placeholder="请输入产品主标题"
                size="small"
                class="pageWidth"
              />
            </el-form-item>
            
          </el-col>

          <el-col :span="24">
            <el-form-item label="副标题：">
              <el-input
                v-model="baseInfoForm.store_info"
                type="textarea"
                :rows="2"
                maxlength="50"
                minilength="10"
                show-word-limit	
                placeholder="请输入产品副标题"
                class="pageWidth"
                size="small"
              />
            </el-form-item>  
          </el-col>
          
          <el-col :span="24">
            <el-form-item label="产品封面图：" prop="image">
              <div
                class="upLoadPicBox"
                title="750*750px"
                @click="modalPicTap('1')"
              >
                <div v-if="baseInfoForm.image" class="pictrue">
                  <img :src="baseInfoForm.image">
                </div>
                <div v-else class="upLoad">
                  <i class="el-icon-camera cameraIconfont" />
                </div>
              </div>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="产品轮播图：" prop="slider_image">
              <div class="acea-row">
                <div
                  v-for="(item, index) in baseInfoForm.slider_image"
                  :key="index"
                  class="pictrue"
                  draggable="false"
                  @dragstart="handleDragStart($event, item)"
                  @dragover.prevent="handleDragOver($event, item)"
                  @dragenter="handleDragEnter($event, item)"
                  @dragend="handleDragEnd($event, item)"
                >
                  <img :src="item">
                  <i
                    class="el-icon-error btndel"
                    @click="handleRemove(index)"
                  />
                </div>
                <div
                  v-if="baseInfoForm.slider_image.length < 10"
                  class="uploadCont"
                  title="750*750px"
                >
                  <div class="upLoadPicBox" @click="modalPicTap('2')">
                    <div class="upLoad">
                      <i class="el-icon-camera cameraIconfont" />
                    </div>
                  </div>
                </div>
              </div>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="主图视频：" prop="video_link">
              <el-input
                v-model="videoLink"
                size="small"
                class="perW50"
                placeholder="请输入MP4格式的视频链接"
              />
              <input
                ref="refid"
                type="file"
                style="display: none;"
                @change="zh_uploadFile_change"
              >
              <el-button
                type="primary"
                icon="ios-cloud-upload-outline"
                class="uploadVideo"
                size="small"
                @click="zh_uploadFile"
              >
                {{ videoLink ? "确认添加" : "上传视频" }}
              </el-button>
              <el-col :span="12">
                <el-progress
                  v-if="upload.videoIng"
                  :percentage="progress"
                  :text-inside="true"
                  :stroke-width="20"
                  style="margin-top: 10px;"
                />
              </el-col>
              <el-col :span="24">
                <div v-if="baseInfoForm.video_link" class="iview-video-style">
                  <video
                    style="width:100%;height: 100%!important;border-radius: 10px;"
                    :src="baseInfoForm.video_link"
                    controls="controls"
                  >
                    您的浏览器不支持 video 标签。
                  </video>
                  <div class="mark" />
                  <i class="el-icon-delete iconv" @click="delVideo" />
                </div>
              </el-col>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="平台产品分类：" prop="cate_id">
              <el-cascader
                v-model="baseInfoForm.cate_id"
                class="pageWidth"
                size="small"
                :options="categoryList"
                :props="props"
                filterable
                clearable
              />
            </el-form-item>
          </el-col>
          <el-col v-if="labelList.length" :span="24">
            <el-form-item label="产品标签：">
              <el-select
                v-model="baseInfoForm.mer_labels"
                size="small"
                multiple
                placeholder="请选择"
                class="pageWidth"
              >
                <el-option
                  v-for="item in labelList"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                />
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="出发城市：" prop="start_city">
              <el-autocomplete
              v-model="baseInfoForm.start_city"
              prefix-icon="el-icon-search"
              :fetch-suggestions="querySearch"
              placeholder="请输入城市"
              class="duanWidth"
              @select="handleSelectStart"
            >
              <template slot-scope="{ item }">
                <div class="name" >
                  {{ item.name }}
                </div>
              </template>
            </el-autocomplete>
            </el-form-item>
          </el-col>
          <el-col :span="18">
            <el-form-item label="目的城市：" prop="end_city">
              <el-autocomplete
              v-model="baseInfoForm.end_city"
              prefix-icon="el-icon-search"
              label="name"
              :fetch-suggestions="querySearch" 
              placeholder="请输入城市"
              class="duanWidth"
              @select="handleSelectEnd"
            >
              <template slot-scope="{ item }">
                <div class="name" >
                  {{ item.name }}
                </div>
              </template>
            </el-autocomplete>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="出发站点：" prop="start_stop_name">
              <el-autocomplete
              v-model="baseInfoForm.start_stop_name"
              prefix-icon="el-icon-search"
              :fetch-suggestions="querySearchStartStop"
              placeholder="请输入出发站点："
              class="duanWidth"
              @select="handleSelectStartStop"
            >
              <template slot-scope="{ item }">
                <div class="name" >
                  {{ item.name }}
                </div>
              </template>
            </el-autocomplete>
            </el-form-item>
          </el-col>
          <el-col :span="18">
            <el-form-item label="到达站点：" prop="end_stop_name">
              <el-autocomplete
              v-model="baseInfoForm.end_stop_name"
              prefix-icon="el-icon-search"
              label="name"
              :fetch-suggestions="querySearchEndStop" 
              placeholder="请输入到达站点："
              class="duanWidth"
              @select="handleSelectEndStop"
            >
              <template slot-scope="{ item }">
                <div class="name" >
                  {{ item.name }}
                </div>
              </template>
            </el-autocomplete>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="关联景区">
              <div class="rulesBox">
                <draggable v-model="baseInfoForm.scenics">
                  <el-tag
                    v-for="(item, indexn) in baseInfoForm.scenics"
                    :key="indexn"
                    closable
                    size="medium"
                    :disable-transitions="false"
                    class="mb5 mr10 move-icon"
                    style="cursor: pointer;"
                    @close="baseInfoForm.scenics.splice(indexn,1)"
                  >{{ item.name }}
                  </el-tag>
                </draggable>
                <el-select
                  v-if="scenicInputVisible"
                  v-model="scenicInputValue"
                  filterable
                  remote
                  reserve-keyword
                  @change="createScenicValue"
                  placeholder="请输入关键词"
                  value-key="name"
                  :remote-method="remoteMethod">
                  <el-option
                    v-for="item in scenicList"
                    :key="item.name"
                    :label="item.name"
                    :value="item"
                   
                    >
                  </el-option>
                </el-select>
                <el-button
                  v-else
                  class="button-new-tag"
                  size="small"
                  @click="showScenicInput()"
                >+ 添加</el-button>
              </div>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="截止购买时间：">
              <div class=" display-flex display-flex-align-center">
                <el-switch
                v-model="baseInfoForm.limit_deadline"
                :active-value="1"
                :inactive-value="0"
                :width="55"
                active-text="开启"
                inactive-text="关闭"
              />
              <div v-if="baseInfoForm.limit_deadline" class="ml-10 display-flex display-flex-align-center">
                <span class="mr-10">最晚需在使用前</span>
                <el-input class="mr-10" v-model="baseInfoForm.deadline_day" placeholder="请输入" type="number" style="width: 80px;"></el-input>
                <span class="mr-10">天</span>
                <el-time-picker
                  v-model="baseInfoForm.deadline_hour"
                  placeholder="请选择"
                  size:="mini"
                  format="HH:mm"
                  value-format="HH:mm"
                  style="width: 100px;"
                  class="mr-10"
                  >
                </el-time-picker>
                <span>购买</span>
              </div>
              </div>
             
            </el-form-item> 
          </el-col>
          <el-col :span="6">
            <el-form-item label="提前检票时间：">
              <el-input type="number" placeholder="请输入提前检票时间" v-model="baseInfoForm.check_time">
                <template slot="append">分钟</template>
              </el-input>
            </el-form-item> 
          </el-col>
          <el-col :span="18">
            <el-form-item label="预计花费时间：" >
              <el-input type="number" placeholder="请输入预计花费时间" v-model="baseInfoForm.duration" style="width: 300px;">
                <template slot="append">分钟</template>
              </el-input>
            </el-form-item> 
          </el-col>
          <el-col :span="10">
            <el-form-item label="价格（仅前端展示，以日期价格为准）：" label-width="200">
              <el-input type="number" placeholder="请输入" v-model="baseInfoForm.price" style="width:150px">
                <template slot="append">元</template>
              </el-input>
            </el-form-item> 
          </el-col>
          <el-col :span="12">
            <el-form-item label="库存（仅前端展示，以日期库存为准）：" label-width="200" >
              <el-input type="number" placeholder="请输入" v-model="baseInfoForm.stock" style="width: 300px;">
              </el-input>
            </el-form-item> 
          </el-col>
          <el-col :span="6">
            <el-form-item label="支持退款：">
              <el-switch
                v-model="baseInfoForm.refund_switch"
                :active-value="1"
                :inactive-value="0"
                :width="55"
                active-text="开启"
                inactive-text="关闭"
              />
            </el-form-item> 
          </el-col>
          <el-col :span="18">
            <el-form-item label="需确认订单：">
              <el-switch
                v-model="baseInfoForm.is_confirm_order"
                :active-value="1"
                :inactive-value="0"
                :width="55"
                active-text="开启"
                inactive-text="关闭"
              />
            </el-form-item> 
          </el-col>

          <el-col v-if="guaranteeList.length" :span="24">
            <el-form-item label="服务保障：">
              <el-select
                v-model="baseInfoForm.guarantee_ids"
                size="small"
                multiple
                placeholder="请选择"
                class="pageWidth"
              >
                <el-option
                  v-for="item in guaranteeList"
                  :key="item.guarantee_id"
                  :label="item.guarantee_name"
                  :value="item.guarantee_id"
                />
              </el-select>
            </el-form-item>
          </el-col>
          
        </el-row>
        <el-form-item style="margin-top:30px;">
          <el-button
           v-if="$route.query.type =='copy'"
            type="primary"
            class="submission"
            size="small"
            @click="submitCopyData()"
          >提交
          </el-button>
          <el-button
            v-else
            type="primary"
            class="submission"
            size="small"
            @click="submitSave()"
          >保存
          </el-button>
          <el-button
            type="primary"
            class="submission"
            size="small"
            @click="handleSubmitNest()"
          >下一步
          </el-button>
          <!-- <el-button
            v-show="currentTab == '5' || $route.params.id"
            :loading="loading"
            type="primary"
            class="submission"
            size="small"
            @click="handleSubmit()"
          >提交
          </el-button> -->
          <!-- <el-button
            :loading="loading"
            type="primary"
            class="submission"
            size="small"
            @click="handlePreview()"
          >预览
          </el-button> -->
        </el-form-item>
      </el-form>
      
      <el-form
      ref="detailForm"
      :key="currentTab"
      class=" mt20"
      :rules="ruleValidate"
      :model="detailForm"
      label-width="130px"
      @submit.native.prevent
      v-if="currentTab == '2'"
      >
      <!-- 产品说明： -->
        <el-row >
          <el-col :span="24">
            <el-col :span="24">
              <el-form-item label="产品说明：">
                <wangeditor
                  style="width: 100%"
                  :content="content"
                  @editorContent="getEditorContent"
              ></wangeditor>
              </el-form-item>
            </el-col>
          </el-col>
        </el-row>
        <el-form-item style="margin-top:30px;">
          <el-button
            v-show="currentTab > 1"
            type="primary"
            class="submission"
            size="small"
            @click="handleSubmitUp"
          >上一步
          </el-button>
          <el-button
           v-if="$route.query.type =='copy'"
            type="primary"
            class="submission"
            size="small"
            @click="submitCopyData()"
          >提交
          </el-button>
          <el-button
            v-else
            type="primary"
            class="submission"
            size="small"
            @click="submitSave()"
          >保存
          </el-button>
          <el-button
            v-show="currentTab < 5"
            type="primary"
            class="submission"
            size="small"
            @click="handleSubmitNest()"
          >下一步
          </el-button>
          
        </el-form-item>
      </el-form>

      <!-- 条款维护 -->
      <el-form
      ref="caluseForm"
      :key="currentTab"
      class=" "
      :model="caluseForm"
      @submit.native.prevent
      v-if="currentTab == '3'"
      >
      
        <el-row >
          <div class="display-flex-column " >
            <el-col :span="24">
              <el-table
                border
                size="small"
                class="specsList"
                ref="tableParameter"
                :data="caluseForm.refund_rate"
                row-key="parameter_value_id"
              >
                <el-table-column
                  align="center"
                  label="取消时间"
                  min-width="120"
                >
                  <template slot-scope="scope">
                    <div v-if="scope.row.type == 1" class="ml-10 display-flex display-flex-align-center h-80">
                      <span class="mr-10">使用日期前</span>
                      <el-form-item style="margin-bottom:0px" :prop="'refund_rate.' + scope.$index + '.refund_time'"   :rules="{ required: true, message: '请输入', trigger: 'blur' }">
                        <el-input class="mr-10" type="number" v-model="scope.row.refund_time"  placeholder="请输入" style="width: 200px;"></el-input>
                      </el-form-item>
                      <span class="mr-10">分钟</span>
                    </div>
                    <div  v-if="scope.row.type == 2" class="ml-10 display-flex display-flex-align-center h-80">
                      <span class="mr-10">使用日期前</span>
                      <el-form-item style="margin-bottom:0px" :prop="'refund_rate.' + scope.$index + '.refund_time'"   :rules="{ required: true, message: '请输入', trigger: 'blur' }">
                        <el-input class="mr-10" type="number" v-model="scope.row.refund_time"  placeholder="请输入" style="width: 200px;"></el-input>
                      </el-form-item>
                      <span class="mr-10">分钟之后</span>
                    </div>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="损失费用（%）" mini-width="100">
                  <template slot-scope="scope">
                    <el-input
                      v-model="scope.row.value"
                      :prop="'refund_rate.' + scope.$index + '.value'"   :rules="{ required: true, message: '请输入', trigger: 'blur' }"
                      :min="0"
                      size="small"
                      placeholder="请输入参数值"
                      class="priceBox"
                    />
                  </template>
                </el-table-column>
                <el-table-column label="操作" min-width="60">
                  <template slot-scope="scope" >
                    <el-button
                     v-if="scope.$index  != 0"
                      type="text"
                      class="submission"
                      size="small"
                      @click.native.prevent="delRufundRate(scope.$index)"
                    >删除</el-button>
                  </template>
                </el-table-column>
              </el-table>
              <el-button
                  type="defalut"
                  size="small"
                  @click="addRefundRate"
                  class="mt-20"
                >添加取消时间
              </el-button>

              <el-form-item   class="mt-30" >
                <div>退改特别说明：</div>
                <wangeditor
                  style="width: 80%"
                  :content="caluseForm.refund_rule"
                  @editorContent="getRefundRule"
              ></wangeditor>
              </el-form-item>
            </el-col>


          </div>
        </el-row>
        <el-form-item style="margin-top:30px;">
          <el-button
            v-show="currentTab > 1"
            type="primary"
            class="submission"
            size="small"
            @click="handleSubmitUp"
          >上一步
          </el-button>
          <el-button
           v-if="$route.query.type =='copy'"
            type="primary"
            class="submission"
            size="small"
            @click="submitCopyData()"
          >提交
          </el-button>
          <el-button
            v-else
            type="primary"
            class="submission"
            size="small"
            @click="submitSave()"
          >保存
          </el-button>
          <el-button
            v-show="currentTab < 5"
            type="primary"
            class="submission"
            size="small"
            @click="handleSubmitNest()"
          >下一步
          </el-button>
          
        </el-form-item>
      </el-form>
    
    </el-card>
    
       <!--属性选择弹窗-->
       <el-dialog v-if="attrShow" :visible.sync="attrShow" title="请选择产品规格" width="320px">
        <attr-list :attrs="attrsList" @activeData="activeAttr" @close="labelAttr" @subAttrs="subAttrs" v-if="attrShow"></attr-list>
      </el-dialog>
      <addPriceDate  ref="priceDate"  :tempAttr="tempAttr" :svip_price_type="skuForm.svip_price_type" :extension_type="skuForm.extension_type" @changePrice="changePrice" ></addPriceDate>
      <editPriceDate  ref="editPriceDate"  :tempAttr="tempAttr" :svip_price_type="skuForm.svip_price_type" :extension_type="skuForm.extension_type" @changePrice="changePrice" ></editPriceDate>

    </div>
</template>

<script>



import wangeditor from "@/components/wangEditor/index.vue";
import routeCard from "@/components/routeCard/index.vue";

import attrList from "@/components/attrList";

import vuedraggable from 'vuedraggable'
import Sortable from 'sortablejs'
import templatesFrom from "@/components/templatesFrom"
import addPriceDate from "@/components/addPriceDate/index.vue"
import editPriceDate from "@/components/editPriceDate/index.vue"

import {
  shippingListApi,
  templateLsitApi,
  productCreateApi,
  productDetailApi,
  categorySelectApi,
  categoryListApi,
  categoryBrandListApi,
  productUpdateApi,
  productConfigApi,
  productGetTempKeysApi,
  guaranteeListApi,
  productPreviewApi,
  getProductLabelApi,
  specsSelectedApi,
  productSpecsDetailApi,
  generateAttrApi,
  associatedFormList,
  associatedFormInfo,
  unitOptionsApi,
  productUnrelatedListApi,
  unitCreatApi,
  productSaveBaseInfoApi,
  productUpdateBaseInfoApi,
  productUpdatDescApi,
  productUpdatRouteApi,
  productUpdatCaluseApi,
  productUpdateSkuApi,
  guaranteeSelectApi,
} from '@/api/product'
import { roterPre } from '@/settings'
import {  getCityListApi,getScenicV2Api} from '@/api/system';
import { title } from "@/settings";
import { forEach } from "jszip/lib/object";

const baseInfoForm = {
  type: 4,
  tour_type: 2,
  product_type:0,
  image: '',
  slider_image: [],
  mer_labels: [],
  scenics: [],
  video_link: '',
  store_name: '',
  store_info: '',
  day_time: '',
  night: '',
  start_city: '',
  end_city:'',
  start_city_id: '',
  end_city_id:'',
  start_stop_name: '',
  end_stop_name:'',
  start_stop_id: '',
  end_stop_id:'',
  limit_deadline: '',
  deadline_day: '',
  deadline_hour: '',
  refund_switch: 1,
  is_confirm_order: 0,
  guarantee_ids: [],
  check_time: 180,
  duration: 0,
  price: 0,
  stock: 999,

}
const detailForm = {
  traitArr1: {
    key: '',
    val: ''
  },
  traitArr2: {
    key: '',
    val: ''
  },
  traitArr3: {
    key: '',
    val: ''
  },
}

const skuForm = {
  
  attr: [],
  attrValue: [
    { 
      image: '',
      price: null,
      cost: null,
      ot_price: null,
      svip_price: null,
      select: false,
      stock: null,
      cdkey: {},
      library_name: "",
      library_id: "",
      bar_code: '',
      weight: null,
      volume: null,
      dateList: [],
    }
  ],
  svip_price_type: 0,
  extension_type: 0,
  spec_type: 0,
 

}
const objTitle = {
  price: {
    title: '售价'
  },
  cost: {
    title: '成本价'
  },
  ot_price: {
    title: '市场价'
  },
  svip_price: {
    title: '付费会员价'
  },
  stock: {
    title: '库存'
  },
  bar_code: {
    title: '产品编号'
  },
  weight: {
    title: '重量（KG）'
  },
  volume: {
    title: '体积(m³)'
  }
}
export default {
  name: 'ProductProductAdd',
  components: {

    wangeditor,
    routeCard,
    attrList,
    draggable: vuedraggable,
    addPriceDate,
    editPriceDate
  },
  data() {

    return {
      roterPre: roterPre,
      product_id: '',
      currentTab: '1',
      baseInfoForm: Object.assign({}, baseInfoForm),
      detailForm: Object.assign({}, detailForm),
      routeForm: {
        productRouteDay:[
        ],
      },
      skuForm: Object.assign({}, skuForm),
      formThead: Object.assign({}, objTitle),
      OneattrValue: [Object.assign({}, skuForm.attrValue[0])], // 单规格
      ManyAttrValue: [Object.assign({}, skuForm.attrValue[0])], // 多规格
      fullscreenLoading: false,
      loading: false,
      videoLink: '',
      upload: {
        videoIng: false // 是否显示进度条；
      },
      progress: 10, // 进度条默认0
      ruleValidate: {
   
        store_name: [
          { required: true, message: '请输入主标题', trigger: 'blur' }
        ],
      
        cate_id: [
          { required: true, message: '请选择平台分类', trigger: 'change' }
        ],
        image: [{ required: true, message: '请上传产品图', trigger: 'change' }],
        slider_image: [
          {
            required: true,
            message: '请上传产品轮播图',
            type: 'array',
            trigger: 'change'
          }
        ],
     
        start_city: [
          { required: true, message: '请选择出发城市', trigger: 'change' }
        ],
        end_city: [
          { required: true, message: '请选择目的城市', trigger: 'change' }
        ],
        start_stop_name: [
          { required: true, message: '请选择出发站点', trigger: 'change' }
        ],
        end_stop_name: [
          { required: true, message: '请选择到达站点', trigger: 'change' }
        ],
        duration: [
          { required: true, message: '请输入预计花费时间', trigger: 'blur' }
        ],
        
      },
  
      
      headTab: [
        { title: '产品信息', name: '1' },
        { title: '产品说明', name: '2' },
        { title: '退改须知', name: '3' },
      ],
      currentCalTab: "1",
      caluesTab: [
        { title: '费用包含', name: '1' },
        { title: '费用不包含', name: '2' },
        { title: '预定限制', name: '3' },
        { title: '预定须知', name: '4' },
        { title: '退改规则', name: '5' },
      ],
     
      traitListOption: [
        '服务保障',
        '贴心赠送',
        '精选酒店',
        '缤纷景点',
        '特色美食',
        '度假首选',
        '超值赠送',
        '精选行程',
        '优质交通'
      ],
      content: '',
      currentDay: "1",
      ra_val: '',
      caluseForm: {
        fee_list: [
          {
            type: 1,
            fee_type: 1,
            check: false,
            title: '交通' ,
            value: ''
          },
          {
            type: 1,
            fee_type: 2,
            check: false,
            title: '住宿' ,
            value: ''
          },
          {
            type: 1,
            fee_type: 3,
            check: false,
            title: '餐食' ,
            value: ''
          },
          {
            type: 1,
            fee_type: 4,
            check: false,
            title: '门票' ,
            value: ''
          },
          {
            type: 1,
            fee_type: 5,
            check: false,
            title: '随团服务人员' ,
            value: ''
          },
          {
            type: 1,
            fee_type: 6,
            check: false,
            title: '保险' ,
            value: ''
          },
          {
            type: 1,
            fee_type: 7,
            check: false,
            title: '补充' ,
            value: ''
          },
        ],
        nofee_list: [
          {
            type: 2,
            fee_type: 1,
            check: false,
            title: '交通' ,
            value: ''
          },
          {
            type: 2,
            fee_type: 2,
            check: false,
            title: '住宿' ,
            value: ''
          },
          {
            type: 2,
            fee_type: 3,
            check: false,
            title: '餐食' ,
            value: ''
          },
          {
            type: 2,
            fee_type: 4,
            check: false,
            title: '门票' ,
            value: ''
          },
          {
            type: 2,
            fee_type: 5,
            check: false,
            title: '单房差' ,
            value: ''
          },
          {
            type: 2,
            fee_type: 6,
            check: false,
            title: '保险' ,
            value: ''
          },
          {
            type: 2,
            fee_type: 7,
            check: false,
            title: '补充' ,
            value: ''
          }
        ],
        booking_list: [
          {
            type: 1,
            check: false,
            title: '是否需要确认订单' ,
            value: ''
          },
          {
            type: 2,
            check: false,
            title: '是否需要需要集合' ,
            value: ''
          },
          {
            type: 3,
            check: false,
            title: '是否需取票' ,
            value: ''
          },
          {
            type: 4,
            check: false,
            title: '适用条件' ,
            value: ''
          },
          {
            type: 5,
            check: false,
            title: '使用说明' ,
            value: ''
          }
        ],
        child_limit: [
          {
            limit_type: 1,
            type: 1,
            check: false,
            value: '该产品支持儿童预定'
          },
          {
            limit_type: 2,
            type: 1,
            check: false,
            value: '本产品因服务能力有限，无法接受14天-2周岁（不含）的婴儿出行'
          },
          {
            limit_type: 3,
            type: 1,
            check: false,
            value: '出于安全考虑，18岁以下的未成年人需至少一名成年旅客陪同'
          },
        ],
        age_limit: [
          {
            limit_type: 1,
            type: 2,
            check: false,
            value: '本产品因服务能力有限，仅接受2周岁（含）-79周岁（含）旅客预定'
          },
          {
            limit_type: 2,
            type: 2,
            check: false,
            value: '此产品行程强度较大，请您确保身体健康适宜旅游，如出行人中有75（含）以上的老人，需至少有一位18周岁至70周岁的亲友陪同出行，敬请谅解！'
          },
          {
            limit_type: 3,
            type: 2,
            check: false,
            value: '本产品因服务能力有限，不接受80周岁（含）以上旅客预定，敬请谅解！'
          },
        ],
        people_limit: [
          {
            limit_type: 1,
            type: 3,
            check: false,
            value: '出于安全考虑，本产品不接受孕妇预订，敬请谅解'
          },
          {
            limit_type: 2,
            type: 3,
            check: false,
            value: '此线路因服务能力有限，仅接受持有中国有效身份证件的客人预订(不含中国香港、中国澳门和中国台湾),敬请谅解！'
          },
       
        ],
        refund_rule: '',
        refund_rate: [
          {
            type: 1,
            refund_time: '',
            value: 0,

          },
          {
            type: 2,
            refund_time: '',
            value: 0,

          }
        ]
      },
      extensionStatus: 0,
      deductionStatus: 0,
      previewVisible: false,
      previewKey: '',
      deliveryType: [],
      open_svip: false,
      svip_rate: 0,
      extension_one_rate: "",
      extension_two_rate: "",
      grid2: {
        xl: 10,
        lg: 12,
        md: 12,
        sm: 24,
        xs: 24
      },
      attrVal: {
        price: null,
        cost: null,
        ot_price: null,
        stock: null,
        bar_code: '',
        weight: null,
        volume: null
      },
      selectRule: '',
      oneFormBatch: [
        {
          attr:"全部",
		      image: "",
          price: "",
          cost: "",
          ot_price: "",
          svip_price: "",
          stock: "",
          cdkey: {},
		      code: "",
          weight: "",
          volume: "",
          dateList: [],
        },
      ],
      createCount: this.$route.params.id ? 0 : -10,
      ruleList: [],
      attrs: [],
      attrsList:[],
			activeAtter:[],
      attrShow: false,
      generateArr: [],
      addGenerate: false,
      isBtn: false,
      isGenerate: false,
      createProduct: false,
       // 规格数据
      formDynamic: {
        attrsName: '',
        attrsVal: ''
      },
      formDynamics: {
        template_name: '',
        template_value: []
      },
      manyTabTit: {},
      manyTabDate: {},
      tempAttr: {},
      flag: 0,
      labelList: [], // 产品标签
      scenicList: [],
      scenicInputVisible: false,
      scenicInputValue: '',
      guaranteeList: [], //服务保障
      merCateList: [], // 商户分类筛选
      categoryList: [], // 平台分类筛选
      props: { emitPath: false },
      propsMer: { emitPath: true },
    }
  },
  computed: {
    attrValue() {
      const obj = Object.assign({}, this.attrVal)
      return obj
    },
  },
  
  watch: {
  
    'skuForm.attr': {   
      handler: function(val) {
        this.createCount+=1
        if (this.skuForm.spec_type === 1) this.watCh(val)
      },
      immediate: false,
      deep: true
    },
    '$route.params.id': {
      handler: function(nVal,oVal) {
        if (nVal !== oVal && nVal){
          this.initData();
        }
      },
      immediate: false,
      deep: true
    }
  },
  created() {
    this.tempRoute = Object.assign({}, this.$route)

  },
  mounted() {
    this.initData();
  },
  destroyed() {
    window.removeEventListener('popstate', this.goBack, false)
  },
  methods: {
    hp_input(e,n){
      console.log(111,e,n)
    },
    initData(){
      this.getCategoryList()
      this.getLabelLst()
      this.getServiceTerms()
      this.productGetRule()
      this.baseInfoForm.slider_image = []
      if (this.$route.params.id) {
        this.product_id = this.$route.params.id
        this.setTagsViewTitle()
        this.getInfo()
      }else{
        this.productCon()
      }
    },
    // 详情
    getInfo() {
      this.fullscreenLoading = true;
      let parmas = {}
      if(this.$route.query.type == 'copy') parmas.is_copy=1
      productDetailApi(this.product_id, parmas)
        .then(async res => {
  
          let info = res.data;
          this.infoData(info);
          this.productCon()
        })
        .catch(res => {
          console.log(22,res)
          this.fullscreenLoading = false;
          this.$message.error(res.message);
        });
    },
    infoData(info) {

      this.attrs = info.attr || [];
      info.attrValue.forEach(val => {
        this.$set(val,'select', true)
        if(info.type == 3){
          this.$set(val,'library_id', val.library_id==0 ? '' : val.library_id)
        }
      });
      this.baseInfoForm = {
        tour_type: info.tour_type || 0, 
        product_type: info.product_type || 0, 
        is_show: info.is_show || 0,
        image: info.image,
        slider_image: info.slider_image,
        store_name: info.store_name,
        store_info: info.store_info,
        cate_id: info.cate_id, // 平台分类id
        mer_cate_id: info.mer_cate_id || [], // 商户分类id
        mer_labels:
          info.mer_labels && info.mer_labels.length
            ? info.mer_labels.map(Number)
            : [],
        content: info.content,
        type: info.type || 0,
        day_time: info.day_time|| '',
        night: info.night|| '',
        start_city: info.start_city|| '',
        end_city:info.end_city || '',
        start_city_id: info.start_city_id|| '',
        end_city_id:info.end_city_id || '',
        start_stop_name: info.start_stop_name|| '',
        end_stop_name:info.end_stop_name || '',
        start_stop_id: info.start_stop_id|| '',
        end_stop_id:info.end_stop_id || '',
        scenics: info.scenics,
        limit_deadline:info.limit_deadline,
        deadline_day: info.deadline_day,
        deadline_hour: info.deadline_hour,
        refund_switch: info.refund_switch,
        is_confirm_order: info.is_confirm_order,
        guarantee_ids: info.guarantee_ids ? info.guarantee_ids.split(",").map(Number) : [],
        check_time: info.check_time || 0,
        duration: info.duration || 0,
        price: info.price || 0,
        stock:  info.stock || 0,
      };

      this.content = info.content;
      var traitList = info.traits? JSON.parse(info.traits): []; 
      if(traitList[0]){
        this.detailForm.traitArr1 = traitList[0]
      }
      if(traitList[1]){
        this.detailForm.traitArr2 = traitList[1]
      }
      if(traitList[2]){
        this.detailForm.traitArr3 = traitList[2]
      }
      this.routeForm = info.productRoute.length?info.productRoute[0]:{ productRouteDay:[],};

      // 费用须知数据
      if(info.productFee.length){
        info.productFee.forEach( a => {
          this.caluseForm.fee_list.forEach( b => {
            if(a.type== b.type && a.fee_type == b.fee_type){
              b.value = a.value;
              b.check = true;
            }
          })
        })
        info.productFee.forEach( a => {
          this.caluseForm.nofee_list.forEach( b => {
            if(a.type== b.type && a.fee_type == b.fee_type){
              b.value = a.value;
              b.check = true;
            }
          })
        })
      }

       // 预定限制数据
      if(info.productLimit.length){
        info.productLimit.forEach( a => {
          this.caluseForm.child_limit.forEach( b => {
            if(a.type== b.type && a.limit_type == b.limit_type){
              b.check = true;
            }
          })
        })
        info.productLimit.forEach( a => {
          this.caluseForm.age_limit.forEach( b => {
            if(a.type== b.type && a.limit_type == b.limit_type){
              b.check = true;
            }
          })
        })
        info.productLimit.forEach( a => {
          this.caluseForm.people_limit.forEach( b => {
            if(a.type== b.type && a.limit_type == b.limit_type){
              b.check = true;
            }
          })
        })
      }

      this.caluseForm.refund_rule = info.productRefundRule?  info.productRefundRule.content: ''
      if(info.productRefundRate.length){
        this.caluseForm.refund_rate = info.productRefundRate;
      }

     // 产品属性
        
      this.skuForm = {
        attr:  info.attr,
        attrValue: info.attrValue,
        svip_price_type: info.svip_price_type,
        extension_type: info.extension_type,
        spec_type: Number(info.spec_type),
        
      };
      if (info.svip_price_type != 0 && info.mer_svip_status){
        this.attrVal = {
          price: null,
          cost: null,
          ot_price: null,
          svip_price: null,
          stock: null,
          // cdkey: {},
          bar_code: "",
          weight: null,
          volume: null,
          dateList: [],
        };
      }

      if (this.skuForm.spec_type === 0) {
        // TODO
        // info.attrValue[0]['list'] = [],
        this.OneattrValue = info.attrValue;    
      } else {
        this.ManyAttrValue = info.attrValue;

        this.generate();
      
      }
      this.getAttr();
        
      console.log("ManyAttrValue11",this.ManyAttrValue)  
      this.fullscreenLoading = false;



    },

    remoteMethod(query) {
      if (query !== '') {
        getScenicV2Api({ name: query })
        .then(res => {
          this.scenicList = res.data
        })
        .catch(res => {
          this.$message.error(res.message)
        })
      } else {
        this.scenicList = [];
      }
    },
         // 商户分类；
      getCategorySelect() {
        categorySelectApi()
          .then(res => {
            this.merCateList = res.data
          })
          .catch(res => {
            this.$message.error(res.message)
          })
      },
      // 平台分类；
      getCategoryList() {
        categoryListApi()
          .then(res => {
            this.categoryList = res.data
          })
          .catch(res => {
            this.$message.error(res.message)
          })
      },
       /** 获取服务条款 */
    getServiceTerms() {
      guaranteeSelectApi().then((res) => {
        this.guaranteeList = res.data;
      })
      .catch(({ message }) => {
        this.$message.error(message)
      })
    },
      // 获取标签项
    getLabelLst() {
      getProductLabelApi()
        .then(res => {
          this.labelList = res.data
        })
        .catch(res => {
          this.$message.error(res.message)
        })
    },
    watCh(val) {
      const tmp = {}
      const tmpTab = {}
      this.skuForm.attr.forEach((o, i) => {
        tmp['value' + i] = { title: o.value }
        tmpTab['value' + i] = ''
      })
      if(this.isGenerate || this.createCount == 1){
        this.ManyAttrValue = this.attrFormat(val)
        this.manyTabTit = tmp
        this.manyTabDate = tmpTab
        this.formThead = Object.assign({}, this.formThead, tmp)
      }
      this.isGenerate = false
      this.addGenerate = false
    },
    attrFormat(arr) {
      let data = [],that = this;
      let res = []
      return format(arr)
      function format(arr) {
        if (arr.length > 1) {
          arr.forEach((v, i) => {
            if (i === 0) data = arr[i]['detail']
            const tmp = []
            data.forEach(function(vv) {
              arr[i + 1] &&
                arr[i + 1]['detail'] &&
                arr[i + 1]['detail'].forEach(g => {
                  const rep2 =
                    (i !== 0 ? '' : arr[i]['value'] + '_$_') +
                    vv +
                    '-$-' +
                    arr[i + 1]['value'] +
                    '_$_' +
                    g
                  tmp.push(rep2)
                  if (i === arr.length - 2) {
                    const rep4 = {
                      image: '',
                      price: 0,
                      cost: 0,
                      ot_price: 0,
                      select: true,
                      sku: "",
                      stock: 0,
                      cdkey: {},
                      cdkeyLibrary: {},
                      library_name: "",
                      library_id: "",
                      bar_code: '',
                      weight: 0,
                      volume: 0,
                      extension_one: 0,
                      extension_two: 0,
                      dateList: [],
                    }
                    rep2.split('-$-').forEach((h, k) => {
                      const rep3 = h.split('_$_')
                      if (!rep4['detail']) rep4['detail'] = {}
                      rep4['detail'][rep3[0]] = rep3.length > 1 ? rep3[1] : ''
                    })
                    // if(rep4.detail !== 'undefined' && rep4.detail !== null){
                    Object.values(rep4.detail).forEach((v, i) => {
                      rep4['value' + i] = v
                    })
                    // }
                    res.push(rep4)
                  }
                })
            })
            data = tmp.length ? tmp : []
          })
        } else {
          const dataArr = []
          arr.forEach((v, k) => {
            v['detail'].forEach((vv, kk) => {
              dataArr[kk] = v['value'] + '_' + vv
              res[kk] = {
                image: '',
                price: 0,
                cost: 0,
                ot_price: 0,
                select: true,
                sku: "",
                stock: 0,
                cdkey: {},
                cdkeyLibrary: {},
                library_name: "",
                library_id: "",
                bar_code: '',
                weight: 0,
                volume: 0,
                extension_one: 0,
                extension_two: 0,
                detail: { [v['value']]: vv },
                dateList: [],
              }
              Object.values(res[kk].detail).forEach((v, i) => {
                res[kk]['value' + i] = v
              })
            })
          })
          data.push(dataArr.join('$&'))   
        }
        if(that.generateArr.length>0){
          that.generateArr.forEach((v, i) => {
            res[i]['image'] = v.image || v.pic
            res[i]['price'] = v.price
            res[i]['cost'] = v.cost
            res[i]['ot_price'] = v.ot_price
            res[i]['sku'] = v.sku
            res[i]['stock'] = v.stock
            res[i]['unique'] = v.unique
            res[i]['bar_code'] = v.bar_code
            res[i]['volume'] = v.volume
            res[i]['weight'] = v.weight
            res[i]['extension_one'] = v.extension_one
            res[i]['extension_two'] = v.extension_two
            res[i]['cdkey'] = v.cdkey&&v.cdkey.length&&v.cdkey[0] || null
            res[i]['cdkeyLibrary'] = v.cdkeyLibrary || {}
            res[i]['library_name'] = v.cdkeyLibrary && v.cdkeyLibrary.name
            res[i]['library_id'] = v.library_id || ""
            res[i]['svip_price'] = v.svip_price || ""
            res[i]['dateList'] = v.dateList || []
          })
        }
        return res
      }
    },
    onChangetype(item) {
      if (item === 1) {
        this.OneattrValue.map(item => {
          this.$set(item, 'extension_one', null)
          this.$set(item, 'extension_two', null)
        })
        this.ManyAttrValue.map(item => {
          this.$set(item, 'extension_one', null)
          this.$set(item, 'extension_two', null)
        })
      } else {
        this.OneattrValue.map(item => {
          delete item.extension_one
          delete item.extension_two
          this.$set(item, 'extension_one', null)
          this.$set(item, 'extension_two', null)
        })
        this.ManyAttrValue.map(item => {
          delete item.extension_one
          delete item.extension_two
        })
      }
    },
    onChangeSpecs(item) {
      if (item == 1 || item == 2 && this.open_svip) {
         this.formThead.svip_price = { title: "付费会员价" }
         this.attrVal = {
          price: null,
          cost: null,
          ot_price: null,
          svip_price: null,
          stock: null,
          bar_code: '',
          weight: null,
          volume: null
        }
        // if(this.formValidate.type == 2)this.attrVal.cdkey = {}
        this.OneattrValue[0]['svip_price'] = this.OneattrValue[0]['price']
          ? this.accMul(this.OneattrValue[0]['price'], this.svip_rate)
          : 0
        let price = 0
        for (const val of this.ManyAttrValue) {
          price = val.price ? this.accMul(val.price, this.svip_rate) : 0
          this.$set(val, 'svip_price', price)
        }
      } else {
        delete this.formThead.svip_price
        this.attrVal = {
          price: null,
          cost: null,
          ot_price: null,
          stock: null,
          bar_code: '',
          weight: null,
          volume: null
        }
      }
    },


// 类型 1.集合 2.结束行程 3.餐饮 4.酒店5.航班6.景点7.自费8.自由活动9.交通10.其他
    filterType(e){
      switch (e) {
          case 1:           
              return "集合";
          case 2:
              return "结束行程";
          case 3:           
              return "餐饮";
          case 4:
              return "酒店";
          case 5:
              return "航班";
          case 6:
              return "景点";
          case 7:
              return "自费";    
          case 8:
              return "自由活动";   
          case 9:
              return "交通";    
          case 10:
              return "其他";         
      }
    },
   

    
    setTagsViewTitle() {
      const title = '编辑产品'
      const route = Object.assign({}, this.tempRoute, {
        title: `${title}-${this.$route.params.id}`
      })
      this.$store.dispatch('tagsView/updateVisitedView', route)
    },

    getEditorContent(data) {
     this.content = data;
    },
    getRefundRule(data) {
      this.caluseForm.refund_rule = data;
    },
    handleSelectStart(e){
     this.baseInfoForm.start_city_id = e.id;
     this.baseInfoForm.start_city = e.name;
    },
    handleSelectEnd(e){
      this.baseInfoForm.end_city_id = e.id;
      this.baseInfoForm.end_city = e.name;
    },
    handleSelectStartStop(e){
     this.baseInfoForm.start_stop_id = e.id;
     this.baseInfoForm.start_stop_name = e.name;
    },
    handleSelectEndStop(e){
      this.baseInfoForm.end_stop_id = e.id;
      this.baseInfoForm.end_stop_name = e.name;
     },
    // 搜索
    querySearch(query, callback) {
      getCityListApi({ name: query ,type: 1, business_type: 1})
        .then(res => {
          callback(res.data)
        })
        .catch(res => {
          this.$message.error(res.message)
        })
    },
    querySearchStartStop(query, callback) {
      if(!this.baseInfoForm.start_city_id){
        return this.$message.error('请先选择出发城市')
      }
      getCityListApi({ name: query, pid: this.baseInfoForm.start_city_id ,business_type: 2})
        .then(res => {
          callback(res.data)
        })
        .catch(res => {
          this.$message.error(res.message)
        })
    },
    querySearchEndStop(query, callback) {
      if(!this.baseInfoForm.end_city_id){
        return this.$message.error('请先选择目的城市')
      }
      getCityListApi({ name: query, pid: this.baseInfoForm.end_city_id ,business_type: 2})
        .then(res => {
          callback(res.data)
        })
        .catch(res => {
          this.$message.error(res.message)
        })
    },

     // 配置
     productCon() {
      productConfigApi()
        .then(res => {
          this.extensionStatus = res.data.extension_status
          this.deductionStatus = res.data.integral_status
          this.deliveryType = res.data.delivery_way.map(String)
          this.open_svip =
            res.data.mer_svip_status == 1 && res.data.svip_switch_status == 1
          this.svip_rate = res.data.svip_store_rate
          this.extension_one_rate = res.data.extension_one_rate
          this.extension_two_rate = res.data.extension_two_rate        
        })
        .catch(res => {
          this.$message.error(res.message)
        })
    },

  

     // 添加规则；
    addRule() {
      const _this = this
      this.$modalAttr(this.formDynamics, function() {
        console.log(213)
        _this.productGetRule()
      })
    },
    // 选择规格
    onChangeProductSpec(num) {
      if (num === 1) this.productGetRule()
    },
      // 获取产品属性模板；
    productGetRule() {
      templateLsitApi().then(res => {
        this.ruleList = res.data
      })
    },


    // 乘法
    accMul(arg1, arg2) {
      var max = 0
      var s1 = arg1.toString()
      var s2 = arg2.toString()
      try {
        max += s1.split('.')[1].length
      } catch (e) {}
      try {
        max += s2.split('.')[1].length
      } catch (e) {}
      return (
        (Number(s1.replace('.', '')) * Number(s2.replace('.', ''))) /
        Math.pow(10, max)
      )
    },
    // 删除表格中的属性
    delAttrTable(index) {
      this.ManyAttrValue.splice(index, 1)
    },
    // 批量添加
    batchAdd() {
      for (const val of this.ManyAttrValue) {
        if(val.select){
          if(this.oneFormBatch[0].dateList.length!= 0)this.$set(val, 'dateList', this.oneFormBatch[0].dateList)
          if(this.oneFormBatch[0].attr!= '')this.$set(val, 'attr', this.oneFormBatch[0].attr)
          if(this.oneFormBatch[0].image!= '')this.$set(val, 'image', this.oneFormBatch[0].image)
          if(this.oneFormBatch[0].price!= null && this.oneFormBatch[0].price!= '')this.$set(val, 'price',  this.oneFormBatch[0].price)
          if(this.oneFormBatch[0].cost!= null && this.oneFormBatch[0].cost!= '')this.$set(val, 'cost', this.oneFormBatch[0].cost)
          if(this.oneFormBatch[0].ot_price!= null && this.oneFormBatch[0].ot_price!= '')this.$set(val, 'ot_price', this.oneFormBatch[0].ot_price)
          if(this.oneFormBatch[0].svip_price!= null && this.oneFormBatch[0].svip_price!= '')this.$set(val, 'svip_price', this.oneFormBatch[0].svip_price)
          if(this.oneFormBatch[0].stock!= null && this.oneFormBatch[0].stock!= '')this.$set(val, 'stock', this.oneFormBatch[0].stock)
          if(this.oneFormBatch[0].bar_code!= null && this.oneFormBatch[0].bar_code!= '')this.$set(val, 'bar_code', this.oneFormBatch[0].bar_code)
          if(this.oneFormBatch[0].weight!= null && this.oneFormBatch[0].weight!= '')this.$set(val, 'weight', this.oneFormBatch[0].weight)
          if(this.oneFormBatch[0].volume!= null && this.oneFormBatch[0].volume!= '')this.$set(val, 'volume', this.oneFormBatch[0].volume)
          if(this.oneFormBatch[0].extension_one!= null && this.oneFormBatch[0].extension_one!= '')this.$set(val, 'extension_one', this.oneFormBatch[0].extension_one)
          if(this.oneFormBatch[0].extension_two!= null && this.oneFormBatch[0].extension_two!= '')this.$set(val, 'extension_two', this.oneFormBatch[0].extension_two)
          if(this.skuForm.type == 2){
            val.cdkey = {}
            if(this.oneFormBatch[0]['cdkey'].is_type == 1){
              if(this.oneFormBatch[0]['cdkey'].list && this.oneFormBatch[0]['cdkey'].list.length){
                this.$set(val.cdkey, "list", this.oneFormBatch[0]['cdkey'].list);
                this.$set(val, "stock", this.oneFormBatch[0]['cdkey'].list.length);
              }
            }else if(this.oneFormBatch[0]['cdkey'].key){
              this.$set(val.cdkey, "key", this.oneFormBatch[0]['cdkey'].key);
            }
            this.$set(val.cdkey, "is_type",this.oneFormBatch[0]['cdkey'].is_type); 
			    }
        }
      }
    },
    // 添加按钮
    addBtn() {
      this.clearAttr()
      this.isBtn = true
      this.addGenerate = true
    },
    // 取消
    offAttrName() {
      this.isBtn = false
    },
    clearAttr() {
      this.formDynamic.attrsName = ''
      this.formDynamic.attrsVal = ''
    },
    // 删除规格
    handleRemoveAttr(index) {
      this.skuForm.attr.splice(index, 1)
      this.ManyAttrValue.splice(index, 1)
    },
    // 删除属性
    handleClose(item, index) {
      item.splice(index, 1)
      this.attrs = this.skuForm.attr;
    },
    // 添加规则名称
    createAttrName() {
      if (this.formDynamic.attrsName && this.formDynamic.attrsVal) {
        const data = {
          value: this.formDynamic.attrsName,
          detail: [this.formDynamic.attrsVal]
        }
        this.skuForm.attr.push(data)
        var hash = {}
        this.skuForm.attr = this.skuForm.attr.reduce(function(
          item,
          next
        ) {
          /* eslint-disable */
          hash[next.value] ? "" : (hash[next.value] = true && item.push(next));
          return item;
        },
        []);
        this.clearAttr();
        this.attrs = this.skuForm.attr;
        this.isGenerate = true;
        this.isBtn = false;
      } else {
        this.$message.warning("请添加完整的规格！");
      }
    },
    // 添加属性
    createAttr(num, idx) {
      if (num) {
        this.skuForm.attr[idx].detail.push(num);
        var hash = {};
        this.skuForm.attr[idx].detail = this.skuForm.attr[
          idx
        ].detail.reduce(function(item, next) {
          /* eslint-disable */
          hash[next] ? "" : (hash[next] = true && item.push(next));
          return item;
        }, []);
        this.skuForm.attr[idx].inputVisible = false;
      } else {
        this.$message.warning("请添加属性");
      }
      this.attrs = this.skuForm.attr;
    },
     // 立即生成
    generate() {
      let id = this.$route.params.id || 0;
      let parmas = {
        attrs: this.skuForm.attr,
        product_type: this.baseInfoForm.product_type
      }
      generateAttrApi(id,parmas)
        .then((res) => {
          let info = res.data
          this.generateArr =  res.data.value
          this.skuForm.attr = res.data.attr;
          this.createProduct = true
          this.isGenerate = true
          if (this.$route.params.id !== "0") {
			      this.addmanyData(info.value);
          }
          if (!this.$route.params.id && this.skuForm.spec_type === 1) { 
            this.ManyAttrValue.map((item) => {
              item.image = (item.image||item.pic) || this.baseInfoForm.slider_image[0];
              this.$set(item,'cdkeyLibrary', {})
        
              // this.$set(item, 'select', true)
            });
          }
					this.getAttr();
        })
        .catch((res) => {
          this.$message.error(res.message);
        });
    },
    //添加价格日历
	  addPrice( row) {

      // 1.批量 2.单规格3.多规格
      this.tempAttr = row;
      console.log(row)

      this.$refs.priceDate.priceDateShow = true;	
        // this.virtualListClear();
	  },

    editPrice( row) {

      this.tempAttr = row;
      console.log(row)

      this.$refs.editPriceDate.editPriceDateShow = true;	
    },
    changePrice(e){
      this.flag++
      console.log(e)

      console.log('OneattrValue',this.OneattrValue)
      console.log('ManyAttrValue',this.ManyAttrValue)
      console.log('oneFormBatch',this.oneFormBatch)
    },
 
     // 选择属性确认
    confirm() {
      if (!this.selectRule) {
        return this.$message.warning('请选择属性')
      } 
      this.ruleList.forEach(item => {
        if (item.attr_template_id === this.selectRule) {
          this.skuForm.attr = item.template_value
          this.attrs = item.template_value
        }
      })
      this.addmanyData(this.ManyAttrValue)
      this.getAttr();
    },
    addmanyData(data){
      data.forEach(item=>{
        item.select = true
      })
      this.ManyAttrValue = data;
    },
    //打开属性
	  batchAttr(){
		  this.attrShow = true;
	  },
    //选中属性
	  activeAttr(e){
		  this.attrsList = e;
	  },
	  //关闭属性弹窗
	  labelAttr(){
	  	this.attrShow = false;
	  },
    //获取属性
		getAttr(){
     
			this.oneFormBatch[0].attr = '全部';
			let data = this.attrs;
			data.map(el=>{
				el.details = [];
				el.detail.map(label=>{
					el.details.push({
						name:label,
						select:false
					})
				})
			})
			this.attrsList = data;
      this.generateArr.forEach((item,index)=>{
        item.sku = this.ManyAttrValue[index]['sku']
      }) 
		},
    //提交属性值；
	  subAttrs(e){
			let selectData = [];
			this.attrsList.forEach((el,index)=>{
				let obj = [];
				el.details.forEach((label)=>{
					if(label.select){
						obj.push(label.name);
					}
				})
				if(obj.length){
					selectData.push(obj)
				}
			})
		  let newData = [];
		  if(selectData.length){
			  newData = this.doCombination(selectData);
		  }
		  this.attrShow = false;
		  this.activeAtter = selectData;
		  this.oneFormBatch[0].attr = newData.length?newData.join(';') : '全部';
      let manyAttr = this.ManyAttrValue
		  manyAttr.forEach(j=> {
        this.$set(j,'select',false)
			  if(newData.length){
				 newData.forEach(item=> {
            if(j.sku && j.sku.split('').length == item.split('').length){
              if(j.sku == item){
                this.$set(j,'select',true)
              }
            }else{
              if(j.sku && j.sku == item){
                this.$set(j,'select',true)
              }
            }
          })
			  }else{
          this.$set(j,'select',true)
			  }
		  })
      this.$nextTick(function(){
        this.$set(this,'ManyAttrValue',manyAttr)
      })
	  },
    showInput(item) {
      this.$set(item, 'inputVisible', true)
    },
    showScenicInput() {
      this.$set(this, 'scenicInputVisible', true)
    },
    createScenicValue(e){
      this.baseInfoForm.scenics.push(e)
      this.$set(this, 'scenicInputVisible', false);
      this.$set(this, 'scenicInputValue', '');
    },
    goBack() {
      sessionStorage.clear()
      window.history.back()
    },
    
    handleRemove(i) {
      this.baseInfoForm.slider_image.splice(i, 1);
    },
    // 点击产品图
    modalPicTap(tit, num, i) {
      const _this = this;
      const attr = [];
      this.$modalUpload(function(img) {
        if (tit === "1" && !num) {
          _this.baseInfoForm.image = img[0];
          _this.OneattrValue[0].image = img[0];
        }
        if (tit === "2" && !num) {
          img.map(item => {
            attr.push(item.attachment_src);
            _this.baseInfoForm.slider_image.push(item);
            if (_this.baseInfoForm.slider_image.length > 10) {
              _this.baseInfoForm.slider_image.length = 10;
            }
          });
        }
        if (tit === "1" && num === "dan") {
          _this.OneattrValue[0].image = img[0];
        }
        if (tit === "1" && num === "duo") {
          _this.ManyAttrValue[i].image = img[0];
        }
        if (tit === "1" && num === "pi") {
          _this.oneFormBatch[0].image = img[0];
        }
   
      }, tit);
    },
    handleSubmitUp() {
      this.currentTab = (Number(this.currentTab) - 1).toString();
    },
    handleSubmitNest() {
      if(this.currentTab == "1") {
        if(!this.product_id){
          this.saveBaseInfo()
        return
        } else {
          this.currentTab = (Number(this.currentTab) + 1).toString();
        }
      } else if(this.currentTab == "2") {
        if(!this.content){
          return this.$message.error("产品特色-请填写产品特色");
        } else {
          this.currentTab = (Number(this.currentTab) + 1).toString();
        }
      } else if(this.currentTab == "3") {
        if(this.checkCaluseForm()) {
          // return this.$message.error("产品条款服务-请填写必填项");
        } else {
          this.currentTab = (Number(this.currentTab) + 1).toString();
        }
      } else {
        // this.currentTab = (Number(this.currentTab) + 1).toString();
      }
      
    },
    submitSave(){
      // 保存基础信息
      if(this.currentTab == "1"){
        this.saveBaseInfo()
        return
      }

       //保存条款
       if(this.currentTab == "2"){
        this.saveDesc()
        return
      }

      //保存条款
      if(this.currentTab == "3"){
        this.saveCaluse()
        return
      }
      
    },
    submitCopyData(){
      productSaveBaseInfoApi(this.baseInfoForm)
        .then(async res => {
          this.product_id = res.data.product_id;
          console.log('123',this.$route.query.type == 'copy')
          if(this.$route.query.type == 'copy'){

            // if(this.content){
            //   productUpdatDescApi(this.product_id, {
            //     traits:  "",
            //     content: this.content
            //   })
            //     .then(async res => {
            //       this.fullscreenLoading = false;
            //       this.$message.success(res.message);
            //       this.loading = false;
            //     })
            //     .catch(res => {
            //       this.fullscreenLoading = false;
            //       this.loading = false;
            //       this.$message.error(res.message);
            //     })
            // }
            // productUpdatCaluseApi(this.product_id, 
            //   {fee_arr: [], limit_list: [],booking_list: [], refund_rule: this.caluseForm.refund_rule, refund_rate: this.caluseForm.refund_rate})
            //   .then(async res => {
            //     this.fullscreenLoading = false;
            //     this.$message.success(res.message);
            //     this.loading = false;
            //   })
            //   .catch(res => {
            //     this.fullscreenLoading = false;
            //     this.loading = false;
            //     this.$message.error(res.message);
            //   })
           
            
          }

          this.fullscreenLoading = false;
          this.$message.success(res.message);
          this.loading = false;
          this.$store.dispatch('tagsView/delView', this.$route).then(({ visitedViews }) => {
                    // this.$router.push({ path: this.roterPre + "/tour/bus/busList" });
                    this.$router.replace({path:this.roterPre +  "/tour/bus/busList"});
                  })
        })
        .catch(res => {
          this.fullscreenLoading = false;
          this.loading = false;
          this.$message.error(res.message);
        });
    },
   
    //预览
    handlePreview(name) {
     
    },



    saveBaseInfo(){
      // 跟团游6
      this.$refs["baseInfoForm"].validate(valid => {
        if (valid) {
          this.fullscreenLoading = true;
          this.loading = true;
          let disCreate = this.$route.params.id && !this.$route.query.type;

          if(disCreate){
            productUpdateBaseInfoApi(this.product_id, this.baseInfoForm)
                .then(async res => {
                  this.fullscreenLoading = false;
                  this.$message.success(res.message);
                  this.loading = false;
              
                })
                .catch(res => {
                  this.fullscreenLoading = false;
                  this.loading = false;
                  this.$message.error(res.message);
                })

          } else {
            productSaveBaseInfoApi(this.baseInfoForm)
                .then(async res => {
                  this.product_id = res.data.product_id;
                  this.$route.params.id = res.data.product_id;

                  this.fullscreenLoading = false;
                  this.$message.success(res.message);
                  this.loading = false;
                })
                .catch(res => {
                  this.fullscreenLoading = false;
                  this.loading = false;
                  this.$message.error(res.message);
                });
          }
        } else {
          if (!this.baseInfoForm.store_name.trim()) {
            return this.$message.warning("基本信息-产品主标题不能为空");
          }
      
          if (!this.baseInfoForm.image) {
            return this.$message.warning("基本信息-产品封面图不能为空");
          }
      
          if (this.baseInfoForm.slider_image.length < 0) {
            return this.$message.warning("基本信息-产品轮播图不能为空");
          }
          if (!this.baseInfoForm.cate_id) {
            return this.$message.warning("基本信息-平台产品分类不能为空");
          }
       
          if (!this.baseInfoForm.start_city) {
            return this.$message.warning("基本信息-请选择出发城市");
          }
      
          if (!this.baseInfoForm.end_city) {
            return this.$message.warning("基本信息-请输入目的城市");
          }

        }
      });
    },

    saveDesc(){
      if(!this.product_id){
        return this.$message.error("请先保存产品信息")
      }
      var list = [];
   
      this.fullscreenLoading = true;
      this.loading = true;
      productUpdatDescApi(this.product_id, {
        traits:  "",
        content: this.content
      })
        .then(async res => {
          this.fullscreenLoading = false;
          this.$message.success(res.message);
          this.loading = false;
        })
        .catch(res => {
          this.fullscreenLoading = false;
          this.loading = false;
          this.$message.error(res.message);
        })
    },

    saveRoute(data){
       // 跟团游6
       if(!this.product_id){
        return this.$message.error("请先保存产品信息")
      }
       this.routeForm = data;
      
     
       console.log("this.routeForm",this.routeForm)



       this.fullscreenLoading = true;
          this.loading = true;
          productUpdatRouteApi(this.product_id, {routeForm: this.routeForm})
          .then(async res => {
            this.fullscreenLoading = false;
            this.$message.success(res.message);
            this.loading = false;
          })
          .catch(res => {
            this.fullscreenLoading = false;
            this.loading = false;
            this.$message.error(res.message);
          })
    },
    
    saveCaluse(){

      if(!this.product_id){
        return this.$message.error("请先保存产品信息")
      }
      for(var i = 0; i <  this.caluseForm.refund_rate.length; i++){
        this.caluseForm.refund_rate[i].product_id = this.product_id;
        this.caluseForm.refund_rate[i].sort = i+1;
      }
     
      console.log("this.caluseForm",this.caluseForm)
      this.$refs["caluseForm"].validate(valid => {
        if (valid) {
     
          this.fullscreenLoading = true;
          this.loading = true;
          productUpdatCaluseApi(this.product_id, 
          {fee_arr: [], limit_list: [],booking_list: [], refund_rule: this.caluseForm.refund_rule, refund_rate: this.caluseForm.refund_rate})
          .then(async res => {
            this.fullscreenLoading = false;
            this.$message.success(res.message);
            this.loading = false;
          })
          .catch(res => {
            this.fullscreenLoading = false;
            this.loading = false;
            this.$message.error(res.message);
          })
         
        } else {
          return this.$message.error("条款服务-参数校验未通过");
        }
      });
    },

    saveSku(){
      if(!this.product_id){
        return this.$message.error("请先保存产品信息")
      }
      if (this.skuForm.spec_type === 1) {
        this.skuForm.attrValue = this.ManyAttrValue;
      } else {
        this.skuForm.attrValue = this.OneattrValue;
        this.skuForm.attr = [];
      }
      if(!this.skuForm.attrValue.length){
        return this.$message.error("请添加规格")
      }
      var flag = false;
      for(var i = 0; i < this.skuForm.attrValue.length; i++){
        if(!this.skuForm.attrValue[i].dateList.length){
          flag = true;
          break
        }
      }
      if(flag){
        return this.$message.error("请检查产品规格价格日历是否全部添加")
      }

      this.fullscreenLoading = true;
      this.loading = true;
      productUpdateSkuApi(this.product_id, this.skuForm)
      .then(async res => {
        this.fullscreenLoading = false;
        this.$message.success(res.message);
        this.loading = false;
      })
      .catch(res => {
        this.fullscreenLoading = false;
        this.loading = false;
        this.$message.error(res.message);
      })
  },
    checkRouteForm(){
      if(this.routeForm.productRouteDay.length <=0){
          this.$message.warning("基本信息-请先添加行程天数");
          this.currentTab = "1";
          return
       }
       var flag = false;
       for(var i= 0;i < this.routeForm.productRouteDay.length; i++){
        if(!this.routeForm.productRouteDay[i].title){
           this.$message.error("第"+(i + 1)+"天的标题为空，请填写！");
           flag = true;
           break;
        }
        if(this.routeForm.productRouteDay[i].productRouteDetail.length <= 0){
           this.$message.error("第"+(i + 1)+"天的行程节点至少添加一个！");
           flag = true;
           break;
        }
        
       }
       return false;
    },
    checkCaluseForm(){
      var fee_list = [];
      for(var i = 0; i < this.caluseForm.fee_list.length; i++){
        if(this.caluseForm.fee_list[i].check == true){
          this.caluseForm.fee_list[i].product_id = this.product_id;
          fee_list.push(this.caluseForm.fee_list[i]);
        }
      }
      if(fee_list.length<=0){
        return this.$message.error("条款维护-请至少添加一条费用包含条目");
      }

      var nofee_list = [];
      for(var i = 0; i < this.caluseForm.nofee_list.length; i++){
        if(this.caluseForm.nofee_list[i].check == true){
          this.caluseForm.nofee_list[i].product_id = this.product_id;
          nofee_list.push(this.caluseForm.nofee_list[i]);
        }
      }
      if(nofee_list.length<=0){
        return this.$message.error("条款维护-请至少添加一条费用不包含条目");
      }
  

      return false;
    },


    
    addRefundRate(){
      this.caluseForm.refund_rate.splice(- 1, 0, {
        type: 1,
        refund_time: '',
        value: 0,
      });
    },
    delRufundRate(index){
      this.caluseForm.refund_rate.splice(index, 1)
    },
  
      // 删除视频；
    delVideo() {
      const that = this
      that.$set(that.baseInfoForm, 'video_link', '')
    },
    zh_uploadFile() {
      if (this.videoLink) {
        this.baseInfoForm.video_link = this.videoLink
      } else {
        this.$refs.refid.click()
      }
    },
    zh_uploadFile_change(evfile) {
      const that = this
      that.progress = 10
      const suffix = evfile.target.files[0].name.substr(
        evfile.target.files[0].name.lastIndexOf('.')
      )
      if (suffix !== '.mp4') {
        return that.$message.error('只能上传MP4文件')
      }
      productGetTempKeysApi().then(res => {
        that.$videoCloud
        .videoUpload({
          type: res.data.type,
          evfile: evfile,
          res: res,
          uploading(status, progress) {
            that.upload.videoIng = status
          }
        })
        .then(res => {
          that.baseInfoForm.video_link = res.url || res.data.src
          that.$message.success('视频上传成功')
          that.progress = 100
        })
        .catch(res => {
          that.upload.videoIng = false
          that.$message.error(res.msg&&res.msg.message || res.message)
        })
      })
    },

    // 表单验证
    validate(prop, status, error) {
      if (status === false) {
        this.$message.warning(error);
      }
    },
    // 规格图片验证
    specPicValidate(ManyAttrValue) {
      for (let i = 0; i < ManyAttrValue.length; i++) {
        if (ManyAttrValue[i].image === "" || !ManyAttrValue[i].image) {
          this.$message.warning("请上传产品规格图！");
          this.picValidate = false;
          break;
        }
      }
    },
    // 移动
    handleDragStart(e, item) {
      this.dragging = item;
    },
    handleDragEnd(e, item) {
      this.dragging = null;
    },
    handleDragOver(e) {
      e.dataTransfer.dropEffect = "move";
    },
    handleDragEnter(e, item) {
      e.dataTransfer.effectAllowed = "move";
      if (item === this.dragging) {
        return;
      }
      const newItems = [...this.baseInfoForm.slider_image];
      const src = newItems.indexOf(this.dragging);
      const dst = newItems.indexOf(item);
      newItems.splice(dst, 0, ...newItems.splice(src, 1));
      this.baseInfoForm.slider_image = newItems;
    },
    leave(){
      const p = new Promise((resolve, reject) => {

        reject()

        })

        return p
    },
   
  }
};
</script>
<style scoped lang="scss">
.bg {
  z-index: 100;
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.1);
}
.goods_detail .goods_detail_wrapper {
  z-index: -10;
}
.iframe-box{
  min-height: 300px;
}
::v-deep .specsList th{
  line-height: 20px!important;
}
::v-deep .specsList th{
  line-height: 20px!important;
}
::v-deep .lytext .el-textarea__inner {
  height: 36px;
}
::v-deep .el-checkbox__inner {
  height: 18px;
  width: 18px;
}

::v-deep  .el-checkbox__input.is-checked .el-checkbox__inner::after {
  top: 2px;
  left: 6px;
}
.proCoupon ::v-deep .el-form-item__content {
  margin-top: 5px;
}
.tabPic {
  width: 40px !important;
  height: 40px !important;
  img {
    width: 100%;
    height: 100%;
  }
}
.noLeft ::v-deep .el-form-item__content {
  margin-left: 0 !important;
}
.explanation{
  color: #909399;
}
.tabNumWidth ::v-deep .el-input-number--medium {
  width: 100px;
}
.tabNumWidth ::v-deep .el-input-number__increase {
  width: 20px !important;
  font-size: 12px !important;
}
.tabNumWidth ::v-deep .el-input-number__increase {
  width: 20px !important;
  font-size: 12px !important;
}
.tabNumWidth ::v-deep .el-input-number__decrease {
  width: 20px !important;
  font-size: 12px !important;
}
.tabNumWidth ::v-deep .el-input-number--medium .el-input__inner {
  padding-left: 25px !important;
  padding-right: 25px !important;
}
.priceBox ::v-deep .el-input__inner {
  padding-right: 15px;
}
.el-input-number.is-controls-right .el-input__inner{
  padding-right: 15px !important;
}
.tabNumWidth ::v-deep .priceBox .el-input-number__decrease,
.tabNumWidth ::v-deep .priceBox .el-input-number__increase{
  display: none;
}
.tabNumWidth ::v-deep .priceBox.el-input-number--small{
  width: 90px!important;
}
.tabNumWidth ::v-deep .el-select {
  width: 120px;
}
.tabNumWidth ::v-deep thead {
  line-height: normal !important;
}
.tabNumWidth ::v-deep .cell {
  line-height: normal !important;
  text-overflow: clip !important;
}
.seeCatMy {
  color: var(--prev-color-primary);
  cursor: pointer;
}	
.selectOn{
	color: var(--prev-color-primary);
}	
.virtual_boder {
  border: 1px solid var(--prev-color-primary);
}
.virtual_boder2 {
  border: 1px solid #e7e7e7;
}
.virtual_san {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 0;
  height: 0;
  border-bottom: 26px solid var(--prev-color-primary);
  border-left: 26px solid transparent;
}
.virtual_dui {
  position: absolute;
  bottom: -2px;
  right: 2px;
  color: #ffffff;
  font-family: system-ui;
}
.virtual {
  width: 120px;
  height: 60px;
  background: #ffffff;
  border-radius: 3px;
  display: inline-block;
  text-align: center;
  padding-top: 8px;
  position: relative;
  cursor: pointer;
  line-height: 23px;
  .virtual_top {
    font-size: 14px;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.85);
  }
  .virtual_bottom {
    font-size: 12px;
    font-weight: 400;
    color: #999999;
  }
}
.virtual:nth-child(2n) {
  margin: 0 12px;
}
.desc{
  color: #999999;
  font-size: 12px;
}
.addfont {
  display: inline-block;
  font-size: 13px;
  font-weight: 400;
  color: var(--prev-color-primary);
  margin-left: 14px;
  cursor: pointer;
}
.titTip {
  display: inline-bolck;
  font-size: 12px;
  font-weight: 400;
  color: #999999;
}
.addCustom_content {
  margin-top: 20px;
  .custom_box {
    margin-bottom: 10px; 
  }
}
.addCustomBox {
  margin-top: 12px;
  font-size: 13px;
  font-weight: 400;
  color: var(--prev-color-primary);
  .btn {
    cursor: pointer;
    width: max-content;
  }
  .remark {
    display: flex;
    margin-top: 14px;
  }
}
.pageWidth {
  width: 460px;
}
.duanWidth{
  width: 200px;
}
.ml15 {
  margin-left: 15px;
}
.button-new-tag {
  height: 28px;
  line-height: 26px;
  padding-top: 0;
  padding-bottom: 0;
}
.input-new-tag {
  width: 90px;
  margin-left: 10px;
  vertical-align: bottom;
}
.pictrue {
  width: 60px;
  height: 60px;
  border: 1px dotted rgba(0, 0, 0, 0.1);
  margin-right: 10px;
  position: relative;
  cursor: pointer;
  img {
    width: 100%;
    height: 100%;
  }
}
.iview-video-style {
  width: 40%;
  height: 180px;
  border-radius: 10px;
  background-color: #707070;
  margin-top: 10px;
  position: relative;
  overflow: hidden;
}
.iconv {
  color: #fff;
  line-height: 180px;
  display: inherit;
  font-size: 26px;
  position: absolute;
  top: -74px;
  left: 50%;
  margin-left: -25px;
}
.iview-video-style .mark {
  position: absolute;
  width: 100%;
  height: 30px;
  top: 0;
  background-color: rgba(0, 0, 0, 0.5);
  text-align: center;
}
.uploadVideo {
  margin-left: 10px;
}
.perW50 {
  width: 50%;
}
.submission {
  margin-left: 10px;
}
.btndel {
  position: absolute;
  z-index: 1;
  width: 20px !important;
  height: 20px !important;
  left: 46px;
  top: -4px;
}
.labeltop ::v-deep .el-form-item__label {
  float: none !important;
  display: inline-block !important;
  margin-left: 120px !important;
  width: auto !important;
}
::v-deep .upload-form-coupon{
  width: 900px!important;
}

.day-title{
  width: 100px;
  padding: 5px 10px;
  background: linear-gradient(90deg, #b0d5f3 0%, #fff 100%, #fff 100%);
  border-radius: 5px;
  color: #000;
  font-weight: 700;
  font-size: 16px;
}
 
.daily_itinerary_con {
  padding: 10px 0 0 74px
}

.daily_itinerary_sub_item {
  position: relative;
  padding-bottom: 0;
}
.daily_itinerary_item .daily_itinerary_sub_item::after,.daily_itinerary_item .daily_itinerary_sub_item::before {
  border-left: 1px dashed #ccc;
  height: 50%;
  z-index: 0;
  position: absolute;
  left: -66px;
  display: block;
  width: 1px;
  content: ""
}
.daily_itinerary_item .daily_itinerary_sub_item::before {
  top: 0;
}
.daily_itinerary_item .daily_itinerary_sub_item::after {
  bottom: 0;
}
.daily_itinerary_sub_time {
  width: 100px;
  //min-height: 40px;
  z-index: 1;
  background: #fff;
  position: absolute;
  left: -76px;
  top: 0;
  text-align: center;
  display: -webkit-box;
  display: -moz-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -moz-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -moz-box-orient: vertical;
  -moz-box-direction: normal;
  -ms-flex-direction: column;
  //flex-direction: column;
  -webkit-box-pack: center;
  -moz-box-pack: center;
  -ms-flex-pack: center;
  //justify-content: center;
  font-size: 14px
}
.daily_itinerary_sub_info {
  padding-bottom: 24px;
  min-height: 52px;
  font-size: 14px;
  margin-left: 30px;
}
.priceDateBox{
  width: 300px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
</style>
